package cn.huihuo.weibo.module;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import org.omg.PortableInterceptor.INACTIVE;

import java.util.List;

/**
 * 用户所添加的渠道
 * Created by zhengjunbo on 2015/10/25.
 */
public class UserChooseChannel extends Model<UserChooseChannel> {
    public static final UserChooseChannel dao = new UserChooseChannel();

    public UserChooseChannel getUserChooseChannel(Integer commId,String userId){
        return findFirst("select * from userchoosechannel where ugc_id=? and user_id=?",commId,userId);
    }

    /**
     * 根据ugcId来获取
     * @param commId
     * @return
     */
    public List<UserChooseChannel> getUserChooseChannel(Integer commId){
        return find("select * from userchoosechannel where ugc_id=? ", commId);
    }

    public int updateUserChooseChannel(Integer id,Integer chooseChannel){
        return Db.update("update userchoosechannel t set t.choose_channel=? where t.id=?",chooseChannel,id);
    }
}
